<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
{{include file="VIEW_PATH/Common/header1.php"}}
	<div id='content_box'>
		<div class="content_left">
			{{foreach from="$goodsData" key="$k" value="$v"}}
			<h2>{{$v['gname']}}</h2>
			{{endforeach}}
			<div class='img_show'>
			  <div class='mid_img'>
			  <div class='mid_show'><img src="{{$data1['big'][0]}}" alt=""rel="{{$data1['big'][0]}}" class="jqzoom" style="width:360px;height: 468px;"/></div>
			  <div class="cover"></div>
			  <div class="kuai"></div>
			  </div>
			  <ul class='sm_img' id="thumblist">
				<li><img src="{{$data1['big'][0]}}" alt=""mid="{{$data1['big'][0]}}" big="{{$data1['big'][0]}}" style="width:70px;height: 91px;"/></li>
				<li><img src="{{$data1['big'][1]}}" alt=""mid="{{$data1['big'][1]}}" big="{{$data1['big'][1]}}" style="width:70px;height: 91px;"/></li>
				<li><img src="{{$data1['big'][2]}}" alt=""mid="{{$data1['big'][2]}}" big="{{$data1['big'][2]}}" style="width:70px;height: 91px;"/></li>
			  </ul>
			</div>
			<div class='big_show'>
		        <img id="big_pic" src="{{$data1['big'][0]}}" alt="" style="width:640px;height: 832px;"/>
			</div>
			<div class='left_info'>
				<div class='info_pr'>
					{{foreach from="$goodsData" key="$k" value="$v"}}
					<span>原价：<del>￥{{$v['marketprice']}}</del></span>
					<span>现价：<b>￥{{$v['shopprice']}}</b></span>
					{{endforeach}}
				</div>
				 <div class="color_all">
				{{foreach from="$data" key="$k" value="$v"}}
           
				<div class='info_color'>
					<dl class='color_num'>
						<dt>{{$v['taname']}}：</dt>
						{{foreach from="$v['sonData']" key="$kk" value="$vv"}}
						<dd gtid="{{$vv['gtid']}}">{{$vv['gtvalue']}}<i></i></dd>
						{{endforeach}}
					</dl>
				</div>
				{{endforeach}}
			</div>

				<div class='info_num'>
					<span>数量：</span>
					<a href="javascript:void(0)" class='min'>-</a>
					<input type="text"  class='show_nom'placeholder="" value="1"/>
					<a href="javascript:void(0)" class='add'>+</a>
					<span>库存<i class='inventory'>0</i>{{$goodsData[0]['unit']}}</span>
				</div>
				<div class='info_btn'>
					<a href="" id="now_buy">立即购买</a>
					<a href="javascript:void(0)" class='add_shop'>加入购物车</a>
				</div>
				<ul>
					<li class='s_first'>服务承诺:</li>
					<li> 退货补运费</li>
					<li>7天无理由退货</li>
					<li>先行赔付</li>
					<li>72小时发货</li>
				</ul>

			</div>
			
		</div>
		<div class='content_right'>
			<h2>热卖推荐</h2>
			<ul>
				{{foreach from="$hotData" key="$k" value="$v"}}
				<li>
					<a href="{{U('index',array('gid'=>$v['gid']))}}">
					<img src="{{$v['pic']}}" alt="" style="width: 120px;height: 160px;"/>
					</a>
					<span>￥{{$v['shopprice']}}</span>
				</li>
				{{endforeach}}
			</ul>
		</div>
	</div>
	<div id="content_all">
		<div class="all_left">
			<p>全部分类</p>
			<ul>
				{{foreach from="$listData" key="$k" value="$v"}}
				<li><span class="glyphicon glyphicon-search" aria-hidden="true"></span><a href="">{{$v['tname']}}</a></li>
				{{endforeach}}
			</ul>
		</div>
		<div class="all_center">
			<div class="center_nav">
				<a href="javascript:;">商品详情</a>
				<a href="javascript:;">商品评价</a>
				<!--<a href="">同类商品</a>-->
			</div>
			 <div class='center_con'>
			 	 {{$data1['intro']}}
			 </div>
			 <div class='center_con cneter_hid'>
				<!--{{$data1['intro']}}-->
				 <!-- 多说评论框 start -->
			<div class="ds-thread" data-thread-key="$dsData['gid']" data-title="$dsData['gname']" data-url="{{U('Content/index',array('gid'=>$dsData['gid']))}}"></div>
				<!-- 多说评论框 end -->
				<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
				<script type="text/javascript">
				var duoshuoQuery = {short_name:"wrap"};
					(function() {
						var ds = document.createElement('script');
						ds.type = 'text/javascript';ds.async = true;
						ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
						ds.charset = 'UTF-8';
						(document.getElementsByTagName('head')[0] 
						 || document.getElementsByTagName('body')[0]).appendChild(ds);
					})();
					</script>
				<!-- 多说公共JS代码 end -->

			 </div>
			
		</div>
		<div class="all_right">
			<p>看了又看</p>
			<ul>
			{{foreach from="$lookData" key="$k" value="$v"}}
				<li>
					<a href="{{U('index',array('gid'=>$v['gid']))}}">
						<img src="{{$v['pic']}}" alt="" />
					</a>
					<span>￥{{$v['shopprice']}}</span>
					<a href="">{{$v['gname']}}</a>
				</li>
			{{endforeach}}
        
			</ul>
		</div>
		
	</div>
	<div class='success'>
		<a href="javascript:void(0)" id='close'><span class="glyphicon glyphicon-remove" aria-hidden="true" ></span></a>
		<h4>提示:</h4>
		<p><span class="glyphicon glyphicon-ok" aria-hidden="true" ></span>&nbsp;&nbsp;已成功添加到购物车</p>
		<a href="" class='look'>再去逛逛</a>
		<a href="{{U('Cart/index')}}" class='buy'>去购物车结算&nbsp;&nbsp;&nbsp;&nbsp;>></a>
	</div>
	</body>
<script>
	$(function(){
		
	$('.color_num dd').click(function(){
	$(this).addClass("selected").siblings().removeClass("selected");
//	aData=$(this).find('.selected').attr('gtid');
	str='';
	$.each($('.selected'), function(){
		str+=$(this).attr('gtid')+',';
	});
//	alert(str.length);
    if(str.length>3){
		$.ajax({
			url:"{{U('selectsql')}}",
			type:'post',
			data :'combine=' + str,
			dataType:'json',
			success:function(data){
            	if(!data.nm){
					alert(data.info);
					$('.inventory').html(0);
					$('#now_buy').css({'background':'#999'});
					return false;
				}else{
					$('.inventory').html(data.info);
				}
			} 
		});
		}
//111111

	})
	})
	
	$(function(){
        $('.add_shop').click(function(){
        var str='';
        var count='';
        $.each($('.selected'), function(){
		str+=$(this).attr('gtid')+',';
	    });
	    count=$('.show_nom ').val();
//	    alert(count);
         $.ajax({
			url:"{{U('Cart/addcart')}}",
			type:'post',
			data :'combine=' + str+'&count='+count,
			dataType:'json',
			success:function(data){
//				 alert(data.state);                                       
				if(!data.state){
					alert(data.info);
					return false;
				}
				if(data.state==1){
					$('.success').show();
//                    alert(data.state);
				}
			}
         });
    })
   $('#close').click(function(){
   	 $('.success').hide();
   })
		
})
</script>

</html>
